/*
 * Copyright 2010. 
 * 
 * This document may not be reproduced, distributed or used 
 * in any manner whatsoever without the expressed written 
 * permission of Boventech Corp. 
 * 
 * $Rev: Rev $
 * $Author: Author $
 * $LastChangedDate: LastChangedDate $
 *
 */

package com.xrkol.sharelib.constants;

import java.io.IOException;
import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

/**
 * @author peng.xia
 * 
 */
public class WXMessageTranslator {

    private static String wxMessagePropertiesFile = "wx_messages.properties";
    private static Properties properties;

    static {
        try {
            Resource property = new ClassPathResource(wxMessagePropertiesFile);
            properties = PropertiesLoaderUtils.loadProperties(property);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getMessage(String code) {
        return properties.getProperty(code) == null ? "unknow" : properties
                .getProperty(code);
    }

}
